import { doGet } from './utils'
export const SYS_INFO_KEY = 'sysInfo'
/**
 * 获取信息信息，并存储到storage中
 */
export const getSysInfo = (self) => {
    doGet('/sys-config/any/pic-config', {}).then(res => {
        if (window.localStorage) {
            let picInfo = res.data
            let picInfoStr = JSON.stringify(picInfo)
            window.localStorage.setItem(SYS_INFO_KEY, picInfoStr)
            window.localStorage.setItem('favicon', picInfo.tabImg)
            if (picInfo.loginBackImg) {
                self.loginStyle = {
                    'background-image': 'url(' + picInfo.loginBackImg + ')'
                }
            }
        }
    }).catch(error => {
        console.log(error)
        self.$message.error('获取系统信息失败')
    })
}